|
|
Suppose that I want to make a new function in povray which takes two
integer parameters, the second one being optional, ie you could call it with
either one or two parameters (eg. "thefunction(1)" or "thefunction(1,2)").
How do I parse this? I just don't get it.
I have tried something like this to parse the second parameter:
Parse_Comma();
EXPECT
CASE (FLOAT_FUNCT_TOKEN)
SecondParam = (int)Token.Token_Float;
EXIT
END_CASE
OTHERWISE
UNGET
EXIT
END_CASE
END_EXPECT
which works if I call it with a number as the second parameter (eg.
"thefunction(1,2)"), but if I call it, for example, with
"thefunction(1,false)", the SecondParam above gets the value '2'.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
|